package com.wkq.move.module.tv.ui.adapter

import android.content.Context
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.wkq.lib_base.adapter.KtDataBindingAdapter
import com.wkq.lib_base.adapter.KtDataBindingViewHolder
import com.wkq.move.R
import com.wkq.move.databinding.ItemTvAboutBinding
import com.wkq.move.databinding.ItemTvActorBinding
import com.wkq.move.databinding.ItemTvSiteBinding
import com.wkq.net.model.UsTvDetailInfo

/**
 *
 * 作者:吴奎庆
 *
 * 时间:2020/5/20
 *
 * 用途:
 */


class TvAboutAdapter(context: Context, layoutId: Int) :
    KtDataBindingAdapter<UsTvDetailInfo.TvAboutInfo>(context, layoutId) {

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        var ktDataBindingViewHolder = holder as KtDataBindingViewHolder
        var itemTvActorBinding = ktDataBindingViewHolder.getBinding() as ItemTvAboutBinding
        itemTvActorBinding.data = getItem(position)
        Glide.with(mContext).load(getItem(position)?.tvPoster).into(itemTvActorBinding.ivActor)

        if (viewClickListener != null) {
            itemTvActorBinding.root.setOnClickListener {
                viewClickListener!!.onViewClick(
                    itemTvActorBinding.root,
                    getItem(position)
                )
            }

        }
    }

}

